/*
 * @(#)SafeUserController.java 2019年9月24日 下午12:19:42
 * Copyright 2019 zmr, Inc. All rights reserved. 
 * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.dev.web.controller.safe;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.dev.bbs.bean.BbsSignInfo;
import com.dev.bbs.domain.BbsUser;
import com.dev.bbs.service.IBbsUserSignService;
import com.dev.framework.util.ShiroUtils;

/**
 * <p>File：SafeUserController.java</p>
 * <p>Title: </p>
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2019 2019年9月24日 下午12:19:42</p>
 * <p>Company: yinrunnet.com </p>
 * @author 张孟如
 * @version 1.0
 */
@Controller
@RequestMapping("safe/user")
public class SafeUserController
{
    private String prefix = "safe/user";
    
    @Autowired
    private IBbsUserSignService bbsUserSignService;


    @GetMapping()
    public String index(Model model)
    {
        BbsUser user=ShiroUtils.getBbsUser();
        BbsSignInfo sign = null;
        if (user != null)
        {
            sign = bbsUserSignService.getSign(user.getUserId());
        }
        else
        {
            // 未登录
            sign = new BbsSignInfo();
        }
        model.addAttribute("sign", sign);
        return prefix + "/index";
    }

    /**
     * 我的帖子
     * @return
     * @author zmr
     */
    @GetMapping("post")
    public String post()
    {
        return prefix + "/post";
    }

    @GetMapping("setting")
    public String setting()
    {
        return prefix + "/setting";
    }
}
